﻿@model Inscriptionem.Models.Menu.Views.PaginationViewModel

@{
    int currentNumber = 0;
}

<div class="pagination">
    <span>Page @Model.CurrentPage of @(Model.TotalPages == 0 ? 1 : Model.TotalPages)</span>
    @foreach (var link in Model.Links)
    {
        if (link.Number != (currentNumber + 1))
        { 
            <text><span>...</span></text>
        }
        
        if (link.IsCurrent)
        {
            <text>
            <span class="current">@link.Number</span>
            </text> 
        }
        else
        {
        <text>
            <a href="@link.URL" class="inactive">@link.Number</a>
        </text> 
        }

        currentNumber = link.Number;
    }
</div>